//
//  FinishInfoVC.swift
//  SBSafetyApp
//
//  Created by Lina on 2022/11/24.
//
// 【【登录】完善信息

import Foundation
import UIKit

class FinishInfoVC: SubLevelViewController {
    let infoV = FinishInfoView()

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        setupUI()
    }
    
    // MARK: - Actions
    @objc func confrimTapped() {
        if infoV.pswTF.titleTF.text != infoV.againPswTF.titleTF.text {
            self.view.showToast(witMsg: "两次密码不一致，请重新输入。")
            return
        }
       /// 修改初始数据
        API.postProfileInitedit(withParam: infoV.profilM) { responseModel in
            if responseModel.errorCode == .Success {
                Utils.app.window?.showToast(witMsg: "修改成功")
                Utils.app.setupMain()
            } else {
                self.view.showToast(witMsg: responseModel.errorMessage)
            }
        }
    }
    
//    @objc func chooseNetTapped() {
//
//    }
    
    // MARK: - Setup
    
    func setupUI() {
//        infoV.netTF.ctl.addTarget(self, action: #selector(chooseNetTapped), for: .touchUpInside)
        infoV.confrimBtn.addTarget(self, action: #selector(confrimTapped), for: .touchUpInside)
        view.addSubview(infoV)
        infoV.snp.makeConstraints { make in
            make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
            make.left.right.bottom.equalToSuperview()
        }
    }
}

